﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <link href="../Plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <link href="../zui/lib/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../Plugins/keyboard/css/keyboard.min.css" rel="stylesheet" />
    <link href="../zui/css/font-awesome.min.css" rel="stylesheet" />
    <link href="../zui/css/zui.min.css" rel="stylesheet" />
    <link href="../Plugins/jquery-step/jquery.steps.css" rel="stylesheet" />
    <link href="../Plugins/sweetalert/sweetalert.css" rel="stylesheet" />
    <link href="../zui/css/app.css" rel="stylesheet" />
    <style type="text/css">
        body {
            font-size: 16px !important;
        }

        .panel-primary > .panel-heading {
            border-radius: 0px;
        }

        .panel {
            margin-bottom: 2px;
        }

        .syxx {
            width: 200px;
            margin-top: 15px;
        }

            .syxx button {
                height: 46px;
            }
        .syxx1 {
            margin-top: 12px;
            margin-left:35px;
        }

            .syxx1 button {
                width:120px;
                height: 55px;
            }

        .highcharts-credits {
            display: none !important;
        }

        .chart-content {
            margin-bottom: 5px;
            box-shadow: 0 3px 4px #ddd;
        }

        .recordMark {
            color: green
        }
        #webcam img {
        width:600px;
        height:600px;
        }
    </style>
</head>
<body>

    <div id="videoControl" style="width:100%;height:100%;background-color:#FFF;border:2px solid double;z-index:9999999!important;position:absolute;display:none">
        <div id="webcam" style="width:80%;left:0px;height:100%; position:absolute;z-index:999999999;background-color:#808080"><noscript><img src="http://127.0.0.1/?action=snapshot" /></noscript></div>

        <div style="width:18%;right:0px;height:100%;top:0px; overflow:hidden; position:absolute">
            <div style="border-radius:0px !important" disabled="disabled">
                <!--<div class="panel-heading">视频录制控制</div>-->
                <div style="height:500px;text-align:center;line-height:100%;padding:0px">


                    <button class="btn btn-success CloseVideo" style="width:160px; margin-top:20px; height:300px;" type="button">关闭</button>
                </div>
            </div>
            <!--<div class="panel panel-primary" style="border-radius:0px !important">
                <div class="panel-heading">试验现象确认</div>
                <div class="panel-body" style="height:160px;padding-top:0px !important;padding-bottom:0px !important">
                    <div class="btn-group btn-group-vertical syxx">
                        <button type="button" class="btn stopExperiment" value="1">试样爆炸</button>
                        <button type="button" class="btn stopExperiment" value="2">试样燃烧</button>
                        <button type="button" class="btn stopExperiment" value="3">试样变色</button>
                        <button type="button" class="btn stopExperiment" value="0">无变化</button>
                    </div>
                </div>
            </div>-->
        </div>

    </div>
    <div id="sycontent" style="height:300px; overflow-y:scroll; overflow-x:hidden !important">
        <div class="row" style="color:#f1a325">
            <div class="col-xs-3">
                <!--试验材料：<span id="Sycl"></span>-->
                设定温度：<span id="Sywd">0</span>℃
            </div>
            <div class="col-xs-2">

            </div>
            <!--<div class="col-xs-4">
                设定紫外光强度：<span id="Gzqd">0</span>μW/cm2
            </div>-->
            <div class="col-xs-3">
                设定试验时长：<span id="Sysc">0</span>h
            </div>
        </div>
        <hr style="border-color:#d0c8c8" />
        <div class="row shiyan-status" style="color:#f1a325;margin-top:35px;height:120px;overflow-y:hidden">
            <div class="col-xs-3" style="margin-top:20px;">
                <div style="margin-left:68px"><img src="../static/images/shiyan1.png" /></div>
            </div>
            <div class="col-xs-9">
                <div style="font-size:30px;margin-top:10px">请先放置试样，准备就绪后开始试验！</div>
            </div>
        </div>
        <div class="row shiyan-status" style="color:#f1a325;margin-top:0px;height:160px;display:none;overflow-y:hidden">
            <div class="col-xs-3" style="margin-top:55px;">
                <div style="margin-left:68px"><img src="../static/images/shiyan1.png" /></div>
            </div>
            <div class="col-xs-9">
                <div style="font-size:20px;margin-top:0px">正在整定环境...</div>
                <div><div class="shiyan-hxwd" style="font-size:30px">获取环境数据中...</div><span style="font-size:20px;display:none">   </span></div>
            </div>
        </div>
        <div class="row shiyan-status" style="color:#f1a325;margin-top:0px;height:160px;display:none;overflow-y:hidden">
            <div class="col-xs-3" style="margin-top:55px;">
                <div style="margin-left:68px"><img src="../static/images/shiyan1.png" /></div>
            </div>

            <div class="col-xs-9">
                <div style="font-size:20px;margin-top:0px;display:none">正在试验中...</div>
                <div><span id="shiyan-time" style="font-size:20px">试验已用时：0分0秒</span><span style="font-size:20px;display:none">  正在试验中... </span></div>
                <div><span class="shiyan-hxwd" style="font-size:30px">获取环境数据中...</span><span style="font-size:20px;display:none">   </span></div>
            </div>
        </div>


        <!--<hr />
        <div class="ibox float-e-margins">
            <div class="ibox-title">

                <div class="ibox-tools">
                </div>
            </div>
            <div class="ibox-content">
                <div class="flot-chart">
                    <div class="chart-content" id="flot-line-chart-moving1" style="width:870px;height:150px"></div>
                </div>
                <div class="flot-chart">
                    <div class="chart-content" id="flot-line-chart-moving2" style="width:870px;height:150px"></div>
                </div>
            </div>
        </div>-->
    </div>

    <div class="shiyan-footer">
        <button style="float:left;margin-right:5px;height: 50px;font-size: 17px;" class="btn btn-danger home-btn" type="button">结束试验</button>
        <!--<button style="float:left;margin-right:5px" class="btn btn-default fm-btn" type="button">开启阀门</button>-->
        <!--<button style="height: 50px;float:left;margin-right:5px" class="btn btn-default  btn-lg sxt-btn" type="button">查看实时图像</button>
        <button style="height: 50px;float:left" class="btn btn-default  btn-lg splj-btn" type="button">暂停旋转</button>-->
        <button style="height: 50px;float:right" class="btn btn-primary  btn-lg start-shiyan" type="button">开始试验</button>
    </div>
    <script src="../zui/lib/jquery/jquery.js"></script>
    <script src="../zui/js/socket.io.min.js"></script>
    <script src="../Plugins/jquery-ui/jquery-ui.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.keyboard.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.mousewheel.min.js"></script>
    <script src="../Plugins/keyboard/js/jquery.keyboard.extension-mobile.min.js"></script>
    <script src="../Plugins/sweetalert/sweetalert.min.js"></script>
    <script src="../Plugins/Highcharts-6.1.0/code/highcharts.js"></script>
    <script src="../Plugins/Highcharts-6.1.0/code/modules/exporting.js"></script>
    <script src="../Plugins/Highcharts-6.1.0/code/modules/export-data.js"></script>
    <script src="../Plugins/jquery-step/jquery.steps.min.js"></script>
    <script src="../zui/lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="../zui/lib/swiper/js/swiper.min.js"></script>
    <script src="../zui/lib/layer/layer.js"></script>
    <script src="../zui/js/utils.js"></script>
    <script src="../zui/js/app.js"></script>
    <script type="text/javascript">
        var shiyan = true;
        var t = 0;
        var index = getQueryString("index");
        //实验ID
        var experimentStepId = "";
        var socket;
        //试样温度
        var temp1 = 0;
        //腔体温度（主）
        var temp2 = 0;
        //腔体温度（辅 PID）
        var temp3 = 0;
        //稳定温度
        var temp4 = 0;
        var kg = 0;
        var fq = 0;
        var kgMark = 0;
        var fqMark = 0;
        var kgStartTime = 0;
        var fqStartTime = 0;
        var tempStatus = 0;
        var startTime = 0;
        var currentShiYanTime = 0;
        var startExperimentMark = false;
        var mainGz = 0;
        $(function () {
            Highcharts.setOptions({
                global: {
                    timezoneOffset: -8 * 60
                }
            });

            $(".syIndex").text(index);
            $("#Sycl").text(sessionStorage.Sycl);
            $("#Sywd").text(sessionStorage.Sywd);
            $("#Sysc").text(sessionStorage.Sysc);
            $(".RecordVideo").click(function () {

                if ($("#VideoRecordStatus").val() == 0) {
                    $("#VideoRecordStatus").val(1);
                    $(".RecordVideo").text("停止录制").removeClass("btn-success").addClass("btn-danger").addClass("disabled");
                    $(".VideoRecordStatusTxt").addClass("recordMark").text("正在录制...");
                    setTimeout(function () {
                        $(".RecordVideo").removeClass("disabled");
                    }, 3000);
                    top.myService.StartRecordVideo(sessionStorage.CurrentExperimentId, parseInt(sessionStorage.syIndex));
                }
                else {
                    $("#VideoRecordStatus").val(0);
                    $(".RecordVideo").text("开始录制").removeClass("btn-danger").addClass("btn-success").addClass("disabled");
                    $(".VideoRecordStatusTxt").removeClass("recordMark").text("未在录制");
                    setTimeout(function () {
                        $(".RecordVideo").removeClass("disabled");
                    }, 3000);
                    top.myService.StopRecordVideo();
                }


            });
            $(".splj-btn").click(function () {
                //top.layer.open({
                //    title: "视频目录配置",
                //    type: 2,
                //    shadeClose: false, //必须点弹窗关闭按钮关闭
                //    shade: 0.1,
                //    closeBtn: 1,
                //    move: false,
                //    area: ['500px', '260px'], //宽高
                //    btn: ['保存', '取消'],
                //    content: ['VideoSetting.html', 'no'],
                //    yes: function (index, layero) {

                //        if (top.sysControl.SaveVideoPath(top.frames[$(layero).find("iframe").prop("name")].getVal()) == "ok") {
                //            top.layer.close(index);
                //            top.layer.msg("保存成功")
                //        }
                //    }
                //});
                if ($(this).text() == "暂停旋转") {
                    $(this).text("恢复旋转");
                    AjaxGet('', 'motor_stop', null, function (res) {
                        if (JSON.parse(res).status == 0) {

                        } else {
                            swal({
                                title: '提示',
                                text: '数据异常',
                                type: 'error',
                                customClass: 'sweetAlert sweetAlert2',
                            });
                        }
                    })

                } else {
                    $(this).text("暂停旋转");
                    AjaxGet('', 'motor_start', null, function (res) {
                        if (JSON.parse(res).status == 0) {

                        } else {
                            swal({
                                title: '提示',
                                text: '数据异常',
                                type: 'error',
                                customClass: 'sweetAlert sweetAlert2',
                            });
                        }
                    })
                }

            });
            $(".OpenVideoPath").click(function () {
                top.myService.OpenExplore(sessionStorage.CurrentExperimentId, parseInt(sessionStorage.syIndex));
            });
            $(".start-shiyan").click(function () {

                layer.confirm(
                    "<span style='font-weight:bolder'>您确定要开始本次试验么？</span>",
                    {
                        btn: ['是的，我确定开始！', '我还没有准备好'],
                        icon: 0,
                        shade: 0.01,
                        title: '操作确认',
                        offset: '3px',
                        closeBtn: 0,
                        move: false
                    },
                    function (index) {
                        layer.close(index);
                        startTime = new Date().getTime();

                        var loadingIndex = top.layer.msg('正在准备开始试验...', {
                            time: 0, icon: 16, shade: 0.01
                        });
                        console.log(sessionStorage, 4342342)
                        $.ajax({
                            url: sessionStorage.CurrentHttpAddress + "/insertExperimentStep",
                            type: "get",
                            data: {
                                experiment_id: sessionStorage.CurrentExperimentId,
                                start_time_stamp: startTime,
                                sywd: parseFloat(sessionStorage.Sywd).toFixed(2),
                                experiment_type: sessionStorage.SyType,
                                sygz: sessionStorage.AirVelocitys
                            },
                            context: document.body,
                            success: function (res) {

                                if (res == 'NOTCLOSE') {
                                    top.layer.msg("柜门未关闭，请先关闭柜门！", { offset: 't' });
                                    return
                                }
                                if (res.indexOf('error') != -1) {

                                    top.layer.msg(res, { offset: 't' });
                                    return
                                }
                                yubei = parent.document.getElementById('example-basic-t-0');
	                	        yubei.href = "javascript:void(0)";
                                $(".splj-btn").removeAttr("disabled");
                                $(".sxt-btn").removeAttr("disabled");
                                setTimeout(function () {

                                    sessionStorage.syIndex = parseInt(sessionStorage.syIndex) + 1;
                                    socket = io.connect(sessionStorage.CurrentHttpAddress + "/temp");
                                    top.layer.close(loadingIndex);
                                    $(".startTimeTxt").text(timestampToTime(startTime));
                                    $(".shiyan-status").eq(1).show().siblings('.shiyan-status').hide();
                                    $(".start-shiyan").addClass("disabled").text("正在试验中...");
                                    $(".ControlMask").hide();

                                    experimentStepId = res;
                                    var totalSesond = parseFloat(sessionStorage.Sysc) * 3600;
                                    var kgAlertIndex = 0;
                                    var fqAlertIndex = 0;
                                    var nomarl = false;
                                    socket.on('server_temp', function (res1) {
                                        var tempTuple = res1.split(',');
                                        temp1 = parseFloat(tempTuple[0]);
                                        temp2 = parseFloat(tempTuple[1]);
                                        temp3 = parseFloat(tempTuple[2]);
                                        temp4 = parseFloat(tempTuple[3]);
                                        temp5 = parseFloat(tempTuple[4]);
                                        temp6 = parseFloat(tempTuple[5]);
                                        kg = parseInt(tempTuple[6]);
                                        fq = parseInt(tempTuple[7]);
                                        temp9 = parseFloat(tempTuple[8]);
                                        if (temp9 != '0' && nomarl == false) {
                                            startTime = new Date().getTime();
                                            nomarl = true;
                                            $(".shiyan-status").eq(2).show().siblings(".shiyan-status").hide();
                                        }
                                        //var gz = parseFloat(temp3).toFixed(2);
                                        //if (gz < 10000.0) {
                                        //    mainGz = gz;
                                        //}
                                        var htmlStr = '<div class="row" style="margin-top: 3px;"><div class="col-xs-12" >环境温度:' + temp1 +'℃</div></div>'
                                            + '<div class="row"><div class="col-xs-6">1层流速:' + temp2 +'ml/min</div>'
                                            + '<div class="col-xs-6">2层流速:' + temp3 +'ml/min</div></div>'
                                            + '<div class="row"><div class="col-xs-6">3层流速:' + temp4 +'ml/min</div>'
                                            + '<div class="col-xs-6">4层流速:' + temp5 +'ml/min</div></div>'
                                            + '<div class="row"><div class="col-xs-12"></div></div>';
                                        $(".shiyan-hxwd").html(htmlStr);
                                    });
                                    setInterval(function () {
                                        if (shiyan) {
                                            currentShiYanTime = new Date().getTime();
                                            var jsTime = currentShiYanTime - startTime;
                                            t = jsTime / 100;
                                            $("#shiyan-time").text("已用时：" + (Math.floor(t / 36000)) + "时" + Math.floor((t % 36000) / 600) + "分" + ((t % 600) / 10).toFixed(2) + "秒");
                                            if (jsTime >= (totalSesond * 1000)) {
                                                shiyan = false;
                                                startExperimentMark = false;
                                                completion(2, 0, 0, 0);

                                            }
                                            if ((Math.floor(t / 10) != 0) && (Math.floor(t / 10) % (parseFloat(sessionStorage.SetInterval) * 3600) == 0)) {

                                                AjaxGet("", "openBeep", null, function (res) {

                                                });
                                                layer.alert('取样时间到！', function (index) {
                                                    AjaxGet("", "closeBeep", null, function (res) {

                                                    });
                                                    layer.close(index);
                                                });
                                            }
                                        }

                                    }, 100);

                                    startExperimentMark = true;
                                }, 1000);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                alert(errorThrown);
                            }
                        });
                    },
                    function () {
                        return;
                    }
                );

            });
            $(".stopExperiment").click(function () {
                var that = this;
                layer.confirm(
                    "您确定发现了<span style='font-weight:bolder;color:red'>“" + ($(that).text()) + "”</span>试验现象么？<br/><span style='font-weight:bolder'>确认后本次试验将结束！</span>",
                    { btn: ['是的，我确认！', '不小心点错了'], icon: 0, shade: 0.01, title: '操作确认', offset: '3px', closeBtn: 0, move: false },
                    function (index) {
                        layer.close(index);
                        var nextType = parseInt(sessionStorage.syIndex) == 1 ? 1 : 2;
                        if ($(that).val() != '0') {
                            nextType = 2;
                        }
                        completion(nextType, 0, $(that).val(), 0);
                    },
                    function () {

                    }
                );

            })

            $(".sxt-btn").click(function () {
                top.sys.startCamera();
                //$("#videoControl").show();
                //$("#sycontent").css("overflow-y", "hidden");
                //if ($(this).text() == "查看实时图像") {
                //    $(this).text("查看试验详情")
                //    $("#videoControl").show();
                //    $("#sycontent").css("overflow-y", "hidden");
                //}
                //else {
                //    $(this).text("查看实时图像")
                //    $("#sycontent").css("overflow-y", "scroll");
                //    $("#videoControl").hide();
                //}
            });
            $(".CloseVideo").click(function () {

                $("#sycontent").css("overflow-y", "scroll");
                $("#videoControl").hide();
            });
            $(".fm-btn").click(function () {
                if ($(this).text() == "关闭阀门") {
                    $(".fm-btn").text("开启阀门")
                    top.sys.motosAuto(2);
                } else {
                    $(".fm-btn").text("关闭阀门")
                    top.sys.motosAuto(1);
                }
            });
            $(".OpenLight").click(function () {
                var swichVal = $(this).attr("val");
                var lightFlag = swichVal == '0' ? "openLight" : "closeLight";
                if (swichVal == '0') {

                    $(this).text("关灯");
                    $(this).attr("val", '1');
                    $.get('http://${sessionStorage.CurrentIP}:8080/?action=command&dest=0&plugin=0&id=10094850&group=1&value=30');
                } else {

                    $(this).text("开灯");
                    $(this).attr("val", '0');
                    $.get('http://${sessionStorage.CurrentIP}:8080/?action=command&dest=0&plugin=0&id=10094850&group=1&value=180');
                }

                AjaxGet("", lightFlag, null, function (res) {

                });

            });
            $(".home-btn").click(function () {
                //if ($(".sxt-btn").text() != "查看摄像头") {
                //    $("#bh").text("实验温度")
                //    $(".sxt-btn").text("查看摄像头")
                //    top.sys.hideCamera();
                //}
                //top.layer.confirm(
                //    "您确定要退出本次试验么？<br/><span style='font-weight:bolder'>退出后本阶段试验数据不再保存！</span>",
                //    { btn: ['是的，我确定结束！', '不小心点错了'], icon: 0, title: '操作确认', offset: '3px', closeBtn: 0, move: false },
                //    function (index) {
                //        top.layer.close(index);
                //        completion(0,0,0,0);
                //    },
                //    function () {

                //    }
                //);
                if (startExperimentMark) {

                    layer.confirm(
                        "<span style='font-weight:bolder'>您确定要结束本次试验么？</span>",
                        { btn: ['是的，我确定结束！', '不小心点错了'], icon: 0, shade: 0.01, title: '操作确认', offset: '3px', closeBtn: 0, move: false },
                        function (index) {
                            layer.close(index);
                            shiyan = false;
                            startExperimentMark = false;
                            completion(2, 0, 0, 0);
                        },
                        function () {

                        }
                    );
                }
                else {
                    top.layer.close(index);
                    completion(0, 0, 0, 0);
                }
                //swal({
                //    title: "您确定要结束本次“标准试验”流程么？",
                //    text: "结束后系统将跳转至主界面，且本次试验数据不再保持！",
                //    type: "warning",
                //    animation: false,
                //    showCancelButton: true,
                //    cancelButtonText: "不小心点错了",
                //    confirmButtonColor: "#DD6B55",
                //    confirmButtonText: "是的，我确定结束！",
                //    closeOnConfirm: false
                //}, function () {
                //    $("#userinfo-btn", top.document).removeClass("disabled");
                //    top.dataOpera.stopDisplayTemp();
                //    $("#content-frame", top.document).attr("src", "Menu.html");
                //    $("#menu-title", top.document).removeClass().addClass("fa fa-home").text(" 功能菜单");

                //});

            });


        })
        function endOpera(that) {
            top.layer.confirm(
                "您确定发现了<span style='font-weight:bolder;color:red'>“" + ($(that).text()) + "”</span>试验现象么？<br/><span style='font-weight:bolder'>确认后本次试验将结束！</span>",
                { btn: ['是的，我确认！', '不小心点错了'], icon: 0, shade: 0.01, title: '操作确认', offset: '3px', closeBtn: 0, move: false },
                function (index) {
                    AjaxGet("", "closeBeep", null, function (res) {

                    });
                    top.layer.close(index);
                    var nextType = parseInt(sessionStorage.syIndex) == 1 ? 1 : 2;
                    if ($(that).val() != '0') {
                        nextType = 2;
                    }
                    completion(nextType, 0, $(that).val(), 0);
                },
                function () {

                }
            );
        }
        function completion(type, tempStatus, sampleStatus, isOpenBeep, fun) {

            shiyan = false;
            //top.myService.HideCamera();
            //top.myService.StopRecordVideo();
            //$("#videoControl").hide();
            var ltxt = type == 0 ? "正在结束试验..." : '正在保存试验数据...';
            var loadingIndex = top.layer.msg(ltxt, {
                time: 0, icon: 16, shade: 0.01
            });
            var firstResult = "";
            if (parseInt(sessionStorage.syIndex) == 1) {
                sessionStorage.tempStatus1 = tempStatus;
                sessionStorage.sampleStatus1 = sampleStatus
                //firstResult += sampleStatus == 0 ? "试验现象未确认，" : `试样发生“${getSampleStatusStr(sampleStatus)}”现象，`;
                //firstResult += `“${(tempStatus==1?"未出现":"出现")}”试样自加热温度超过10秒钟大于等于3℃情况`;
            } else {
                sessionStorage.tempStatus2 = tempStatus;
                sessionStorage.sampleStatus2 = sampleStatus
            }
            $.ajax({
                url: sessionStorage.CurrentHttpAddress + "/stopExperimentStep",
                type: "get",
                data: {
                    experiment_step_id: experimentStepId, stot_time_stamp: currentShiYanTime,
                    time_cost: (currentShiYanTime - startTime), isOpenBeep: isOpenBeep,
                    tempStatus: tempStatus, sampleStatus: sampleStatus
                },
                context: document.body,
                success: function (res) {

                    top.layer.close(loadingIndex);
                    if (res != '1') {
                        //top.layer.alert(res);
                    }

                    switch (type) {
                        case 0:
                            $("#userinfo-btn", top.document).removeClass("disabled");
                            $("#content-frame", top.document).attr("src", "Menu.html");
                            $("#menu-title", top.document).removeClass().addClass("fa fa-home").text(" 功能菜单");
                            break;
                        case 1:
                            if (isOpenBeep == 0) {
                                parent.stepNext();
                            }
                            if (fun != null) {
                                fun();
                            }
                            break;
                        case 2:
                            var result = '';
                            result += sampleStatus
                            $.ajax({
                                url: sessionStorage.CurrentHttpAddress + "/updateExperiment",
                                type: "get",
                                data: {
                                    experiment_id: sessionStorage.CurrentExperimentId,
                                    total_count: parseInt(sessionStorage.syIndex),
                                    result: ''
                                },
                                success: function (res) {
                                    if (isOpenBeep == 0) {
                                        parent.stepNext();
                                        parent.stepNext();
                                    }
                                    if (fun != null) {
                                        fun();
                                    }
                                    $('#content-frame3', window.parent.document).attr("src", "Result.html?experimentId=" + sessionStorage.CurrentExperimentId);

                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    if (error == null) {
                                        alert(errorThrown);
                                    }
                                    else {
                                        error(errorThrown);
                                    }
                                }
                            });


                        default:
                    }


                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });

        }
        function pjz(time1, time2) {

            var cha = Math.abs(Number(time2) - Number(time1)) / 10;
            var pj = ((Number(time2) + Number(time1)) / 20);

            return pj;
        }
        function xs(time1, time2) {

            var cha = Math.abs(Number(time2) - Number(time1)) / 10;
            var pj = ((Number(time2) + Number(time1)) / 20);

            return cha / pj;
        }
                //Highcharts.setOptions({
                //    global: {
                //        useUTC: false
                //    }
                //});

                //Highcharts.chart('flot-line-chart-moving1', {
                //    chart: {
                //        type: 'spline',
                //        animation: Highcharts.svg, // don't animate in old IE
                //        marginRight: 10,
                //        events: {
                //            load: function () {

                //                // set up the updating of the chart each second
                //                var series = this.series[0];
                //                var series1 = this.series[1];
                //                setInterval(function () {
                //                    if (startExperimentMark) {
                //                        var x = (new Date()).getTime(); // current time
                //                        series.addPoint([x, temp1 < 1 ? null : temp1], true, true);
                //                    }

                //                }, 1000);
                //            }
                //        }
                //    },
                //    title: {
                //        text: '环境温度实时监测'
                //    },
                //    xAxis: {
                //        type: 'datetime',
                //        tickPixelInterval: 150
                //    },
                //    yAxis: {
                //        //max: 100,
                //        title: {
                //            text: '温度 ℃'
                //        },
                //        //plotLines: [{
                //        //    label: {
                //        //        text: '我是标示线的标签',     //标签的内容
                //        //        align: 'left',                //标签的水平位置，水平居左,默认是水平居中center
                //        //        x: 10                         //标签相对于被定位的位置水平偏移的像素，重新定位，水平居左10px
                //        //    },
                //        //    value: 30,
                //        //    width: 2,
                //        //    color: '#808888'
                //        //}]
                //    },
                //    plotOptions: {
                //        spline: {
                //            lineWidth: 2,
                //            states: {
                //                hover: {
                //                    lineWidth: 3
                //                }
                //            },
                //            marker: {
                //                enabled: false
                //                //radius: 10
                //            },
                //            pointInterval: 3600000, // one hour
                //            pointStart: Date.UTC(2009, 9, 6, 0, 0, 0)
                //        }
                //    },
                //    tooltip: {
                //        formatter: function () {
                //            return '<b>' + this.series.name + '</b><br/>' +
                //                Highcharts.dateFormat('时间：%Y-%m-%d %H:%M:%S', this.x) + '<br/>温度：' +
                //                Highcharts.numberFormat(this.y, 2) + '℃';
                //        }
                //    },
                //    legend: {
                //        enabled: false
                //    },
                //    exporting: {
                //        enabled: false
                //    },
                //    series: [

                //        {
                //            name: '环境温度',
                //            marker: {
                //                symbol: 'square1'
                //            },
                //            data: (function () {
                //                // generate an array of random data
                //                var data = [],
                //                    time = (new Date()).getTime(),
                //                    i;

                //                for (i = -59; i <= 0; i += 1) {
                //                    data.push({
                //                        x: time + i * 1000,
                //                        y: null
                //                    });
                //                }
                //                return data;
                //            }())
                //        }
                //    ]
                //});

                //Highcharts.chart('flot-line-chart-moving2', {
                //    chart: {
                //        type: 'spline',
                //        animation: Highcharts.svg, // don't animate in old IE
                //        marginRight: 10,
                //        events: {
                //            load: function () {

                //                // set up the updating of the chart each second
                //                var series = this.series[0];
                //                var series1 = this.series[1];
                //                setInterval(function () {
                //                    if (startExperimentMark) {
                //                        var x = (new Date()).getTime(); // current time
                //                        series.addPoint([x, temp2 < 1 ? null : temp2], true, true);
                //                    }

                //                }, 1000);
                //            }
                //        }
                //    },
                //    title: {
                //        text: '紫外光强度实时监测'
                //    },
                //    xAxis: {
                //        type: 'datetime',
                //        tickPixelInterval: 150
                //    },
                //    yAxis: {
                //        title: {
                //            text: '紫外光强度 μW/cm2'
                //        },
                //    },
                //    plotOptions: {
                //        spline: {
                //            lineWidth: 2,
                //            states: {
                //                hover: {
                //                    lineWidth: 3
                //                }
                //            },
                //            marker: {
                //                enabled: false
                //                //radius: 10
                //            },
                //            pointInterval: 3600000, // one hour
                //            pointStart: Date.UTC(2009, 9, 6, 0, 0, 0)
                //        }
                //    },
                //    tooltip: {
                //        formatter: function () {
                //            return '<b>' + this.series.name + '</b><br/>' +
                //                Highcharts.dateFormat('时间：%Y-%m-%d %H:%M:%S', this.x) + '<br/>温度：' +
                //                Highcharts.numberFormat(this.y, 2) + '℃';
                //        }
                //    },
                //    legend: {
                //        enabled: false
                //    },
                //    exporting: {
                //        enabled: false
                //    },
                //    series: [

                //        {
                //            name: '紫外光强度',
                //            marker: {
                //                symbol: 'square1'
                //            },
                //            data: (function () {
                //                // generate an array of random data
                //                var data = [],
                //                    time = (new Date()).getTime(),
                //                    i;

                //                for (i = -59; i <= 0; i += 1) {
                //                    data.push({
                //                        x: time + i * 1000,
                //                        y: null
                //                    });
                //                }
                //                return data;
                //            }())
                //        }
                //    ]
                //});

    </script>
</body>
</html>
